# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2023年03月21日
"""
import openpyxl

myBook=openpyxl.load_workbook('销量排行表.xlsx',data_only=True)
mySheet=myBook.active
myRows=list(mySheet.values)[1:]
myDict={}
while mySheet.max_row>1:
	mySheet.delete_rows(2)

for myRow in myRows:
	if myRow[3] in myDict.keys():
		myDict[myRow[3]]+=[myRow]
	else:
		myDict[myRow[3]]=[myRow]
for myPress in myDict.keys():
	myRows=sorted(myDict[myPress],key=lambda x:x[2])
	mySheet.append(myRows[0])
myBook.save('结果表-销量排行表.xlsx')

